home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- ///////////////////////////////////////////////////////////////
- // OkFile.h --
- ///////////////////////////////////////////////////////////////
- #ifndef OKFILE_H
- #define OKFILE_H
-
- #include <Xm/Xm.h>
- #include <stdio.h>
- #include <unistd.h>
- #include <iostream.h>
- #include <fstream.h>
-
-
- class OkFileItem;
-
- class OkFile {
-
- private:
- fstream _file;
-
- public:
- OkFile();
- OkFile( const char* fileName=NULL, int mode=ios::in );
- virtual ~OkFile();
-
- fstream& file() { return _file; }
-
- void open( const char* fileName, int mode );
- void close() { _file.close(); }
-
- void read( OkFileItem* item );
- void write( OkFileItem* item );
-
- // General purpose file manipulation functions:
-
- static Boolean Exists( const char* fileName )
- { return ( ! access( fileName, F_OK ) ); }
- static Boolean Readable( const char* fileName )
- { return ( ! access( fileName, R_OK ) ); }
- static Boolean Writable( const char* fileName )
- { return ( ! access( fileName, W_OK ) ); }
- static Boolean Executable( const char* fileName )
- { return ( ! access( fileName, X_OK ) ); }
-
- static int Rename( const char* oldName, const char* newName )
- { return rename( oldName, newName ); }
- static int Unlink( const char* fileName )
- { return unlink( fileName ); }
-
- // Caller is responsible to free the returned string.
- static char* PathBaseName( const char* path );
- static char* PathDirName( const char* path );
- static char* PathExpandTilde( const char* path );
-
- };
-
- #endif
-